<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
  </style>
</head>
<body>
  <div class="the_div">
    <p>我是p标签</p>
    <h3>我是h3</h3>
    <h3>我是h3</h3>
    <h3>我是h3</h3>
    <a id="theA" href="#">我是一个a标签</a>
    <ul>
        <li>北京</li>
        <li>天津</li>
        <li>南京</li>
    </ul>
    <ol class="my_li">
        <li>大张</li>
        <li>大王</li>
        <li>大狗</li>
    </ol>
    <ul class="my_li">
        <li>小明</li>
        <li>小红</li>
        <li>小蓝</li>
    </ul>
    
</div>
<script>
//练习1：
const a=document.querySelector('#theA')

//练习2：
const h3s=document.querySelectorAll('.the_div h3')
h3s.forEach(function(item){
  console.log(item);
})

//练习3：
 const lis=document.querySelectorAll('.the_div li')

//练习4：
const list=document.querySelectorAll('.the_div ul:last-child li')

//练习5：
const list1=document.querySelectorAll('.the_div ul:last-child li')
console.log(list1);
list1[1].innerText='小六'
list1[1].style.color='red'

//练习6：
const ul=document.querySelector('.the_div ul li:nth-child(2)')
 ul.classList.add('hc')
 ul.style.backgroundColor='lawngreen'
</script>
</body>
</html>